require_extension(EXT_ZFH);
require_extension(EXT_ZFA);
require_fp;
{
  static const uint16_t bits[32] = {
    [0b00000] = 0xbc00,  /* -1.0 */
    [0b00001] = 0x0400,  /* minimum positive normal */
    [0b00010] = 0x0100,  /* 1.0 * 2^-16 */
    [0b00011] = 0x0200,  /* 1.0 * 2^-15 */
    [0b00100] = 0x1c00,  /* 1.0 * 2^-8  */
    [0b00101] = 0x2000,  /* 1.0 * 2^-7  */
    [0b00110] = 0x2c00,  /* 1.0 * 2^-4  */
    [0b00111] = 0x3000,  /* 1.0 * 2^-3  */
    [0b01000] = 0x3400,  /* 0.25 */
    [0b01001] = 0x3500,  /* 0.3125 */
    [0b01010] = 0x3600,  /* 0.375 */
    [0b01011] = 0x3700,  /* 0.4375 */
    [0b01100] = 0x3800,  /* 0.5 */
    [0b01101] = 0x3900,  /* 0.625 */
    [0b01110] = 0x3a00,  /* 0.75 */
    [0b01111] = 0x3b00,  /* 0.875 */
    [0b10000] = 0x3c00,  /* 1.0 */
    [0b10001] = 0x3d00,  /* 1.25 */
    [0b10010] = 0x3e00,  /* 1.5 */
    [0b10011] = 0x3f00,  /* 1.75 */
    [0b10100] = 0x4000,  /* 2.0 */
    [0b10101] = 0x4100,  /* 2.5 */
    [0b10110] = 0x4200,  /* 3 */
    [0b10111] = 0x4400,  /* 4 */
    [0b11000] = 0x4800,  /* 8 */
    [0b11001] = 0x4c00,  /* 16 */
    [0b11010] = 0x5800,  /* 2^7 */
    [0b11011] = 0x5c00,  /* 2^8 */
    [0b11100] = 0x7800,  /* 2^15 */
    [0b11101] = 0x7c00,  /* +inf (2^16 is not expressible) */
    [0b11110] = 0x7c00,  /* +inf */
    [0b11111] = defaultNaNF16UI
  };
  WRITE_FRD_H(f16(bits[insn.rs1()]));
}
